package o;

import android.app.Activity;
import android.content.Intent;
import android.os.Build.VERSION;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import androidx.annotation.IntRange;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;

public class fe extends fo {
    private static c ˏ;

    public interface d {
        void onRequestPermissionsResult(int i, @NonNull String[] strArr, @NonNull int[] iArr);
    }

    @RestrictTo({androidx.annotation.RestrictTo.d.ॱ})
    public interface e {
        void c_(int i);
    }

    public interface c {
        boolean ˊ(@NonNull Activity activity, @NonNull String[] strArr, @IntRange(from = 0) int i);

        boolean ॱ(@NonNull Activity activity, @IntRange(from = 0) int i, int i2, @Nullable Intent intent);
    }

    protected fe() {
    }

    @RestrictTo({androidx.annotation.RestrictTo.d.ॱ})
    public static c ˊ() {
        return ˏ;
    }

    public static void ॱ(@NonNull Activity activity, @NonNull Intent intent, int i, @Nullable Bundle bundle) {
        if (VERSION.SDK_INT >= 16) {
            activity.startActivityForResult(intent, i, bundle);
        } else {
            activity.startActivityForResult(intent, i);
        }
    }

    public static void ˏ(@NonNull Activity activity) {
        if (VERSION.SDK_INT >= 16) {
            activity.finishAffinity();
        } else {
            activity.finish();
        }
    }

    public static void ˏ(@NonNull Activity activity, @NonNull String[] strArr, @IntRange(from = 0) int i) {
        if (ˏ != null && ˏ.ˊ(activity, strArr, i)) {
            return;
        }
        if (VERSION.SDK_INT >= 23) {
            if (activity instanceof e) {
                ((e) activity).c_(i);
            }
            activity.requestPermissions(strArr, i);
        } else if (activity instanceof d) {
            new Handler(Looper.getMainLooper()).post(new 4(strArr, activity, i));
        }
    }
}
